package com.example.library_common.db

import androidx.room.*

@Dao
interface ShoppingCarDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun save(shop_car: ShopCarBean?): Long

    //如果是一对多,这里可以写List<Cache>
    @Query("select *from shop_car_bean where `userId`=:userId")
    fun getCache(userId: String?): ShopCarBean?

    //只能传递对象昂,删除时根据Cache中的主键 来比对的
    @Delete
    fun delete(shop_car: ShopCarBean?): Int

    //删全部
    @Query("DELETE FROM shop_car_bean")
    fun deleteAll()

    //只能传递对象昂,删除时根据Cache中的主键 来比对的
    @Update(onConflict = OnConflictStrategy.REPLACE)
    fun update(user_info: ShopCarBean?): Int

}